import 'package:flutter/material.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xinxuan/utils/color_util.dart';

class PayTypeItem extends StatelessWidget {

  final String iconPath;
  final String title;
  final bool isSelected;
  final Function onTap;
  final bool showBorder;
  final bool showRigth;

  PayTypeItem({
    required this.iconPath, 
    required this.title, 
    required this.isSelected, 
    required this.onTap, 
    this.showBorder = true,
    this.showRigth = false
  });

  @override
  Widget build(BuildContext context) {
    return InkWellUtil.shakeProofInkWell(Container(
      padding: EdgeInsets.symmetric(horizontal: 4, vertical: 16.h),
      decoration: BoxDecoration(
        border: Border(
          bottom: showBorder ? BorderSide(
            color: lineColor,
            width: .5
          ) : BorderSide.none
        )
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            children: [
              Image.asset(
                iconPath,
                width: 28.w,
                height: 28.w,
              ),
              SizedBox(width: 8.w),
              Text(
                title,
                style: TextStyle(
                  color: textBlackColor,
                  fontSize: 14.sp
                ),
              )
            ],
          ),
          showRigth ? Image.asset(
            'assets/icons/icon_arrow_right.png',
            width: 15.w,
            height: 15.w,
          ) : Image.asset(
            isSelected ?  'assets/icons/icon_radio_fill.png' : 'assets/icons/icon_radio_line.png',
            width: 20.w,
            height: 20.w,
          )
        ],
      ),
    ), () => onTap());
  }
}